<%-- 
    Document   : contactDetail1
    Created on : Jun 8, 2012, 12:03:36 PM
    Author     : VANANH
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>

<html>
    <head>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/confirm.js"></script>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery.fancybox-1.3.4.pack.js"></script>
        <!-- -->
        <link rel="stylesheet" type="text/css" href="../scripts/tabs/slidingtabs-horizontal.css">
        <script type="text/javascript" src="../scripts/tabs/slidetab.js"></script>
        <!-- -->
        <link rel="stylesheet" type="text/css" href="../css/paging.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery.rateit.js"></script>
        <link rel="stylesheet" type="text/css" href="../css/rateit.css">
        <link rel="stylesheet" type="text/css" href="../css/richTable.css"/>
        <link rel="stylesheet" type="text/css" href="../css/thickbox.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/thickbox.js"></script>
        <script type="text/javascript" language="javascript">
            var open_cur = 0;
            $j = jQuery.noConflict();
            $j(document).ready(function(){  
                
                initThickBox('.thickbox');
                
                $j('.keysearch').live('keyup',function(){
                    if($j('.keysearch').val() == ""){
                        $j('.noteRow').show();
                                   
                    }else{
                        $j('.noteRow').hide();
                        $j('.noteRow').each(function(){
                            html = $j(this).html();
                            if(   ununicode(html).indexOf(  ununicode($j('.keysearch').val()) ) > -1    )  {
                                $j(this).show();
                            }else{
                                $j(this).hide();
                            }
                        });
                    }

                }); 
                
                $j('.checkComplete').live('change',function(){
                    pb630  = $j(this).attr('lang');
                    if($j(this).is(':checked')){
                        $j.post('actionB630.jsp?action=checkComplete&status=T&pb630='+pb630,function(data){
                            if(data!=null){
                                window.location.href=("workChargeCM.jsp");
                            }
                        });
                    }
                });
                
                $j('.showNote').live('click',function(){
                    var pb630 = $j(this).attr('lang');  
                    var title = $j(this).parent().parent().attr('name');                    
                    $j('.noteContent').slideUp();
                    $j('.noteContent').html(''); 
                    var note = $j(this).parent().parent().next().find('.noteContent');  
                    var title = $j(this).parent().parent().attr('lang');  
                    if(note.hasClass('active')){
                        note.removeClass('active');
                    }else{
                                                 
                        note.removeClass('active');
                        note.addClass('active');                                               
                        // showPleaseWait();                      
                        $j.post('noteWorkCharge.jsp?action=loadB650&pb630='+pb630+"&title="+title,function(data){                      
                            if(data !=null){
                                //                                alert(sms.attr('class'));
                                note.css('min-height','50px');
                                note.html(data);
                                note.slideDown();
                                //  hidePleaseWait();
                            }
                        });
                        //                    }
                     
                    }
                });
         
            });
        </script>
        <style type="text/css"> 
            .showNote{
                cursor: pointer;
            } 
            .odd {
                background: none repeat scroll 0 0 #E0EFFC;
            }
            .content_table {
                float: left;
                overflow: auto;
                width: 920px;
                margin-left: 20px;
            }
            .viewData{
                float: left;
                overflow: auto;
                width: 2287px;
            }

            .fields_input{
                float: left;
                margin-top:4px;
                width: 100%;
            }
            .table_subheadercell {
                height: 25px;   
            }
            .noteContent{
                width: 100%;
                height: auto;                
                float:left;
                display : none;
                border-bottom: 1px solid #C4C0C9;
                border-right: 1px solid #C4C0C9;
            }

            input{
                float:left;
                margin-left:9px;
            }
            /*            select{
                            float:left;
                            height: 21px;
                            width:166px;
                            margin-left:9px;
                        }
            */



            .feild_sex td label{width: 150px !important; color:white; font-size:12px; text-transform: none; margin-left:3px;}


        </style>
    </head>

    <body>
        <f:view>
            <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
            <a4j:form >
                <div class="content_detail">
                    <div class="list_item_user">
                        <div class="item_content" style="display: block">
                            <div class="infomation_form"> 
                                <div class="card_add" style="display:<h:outputText value="#{B630Bean.displaycus}"/>">
                                    <h:outputLink   rendered="#{loginSession.right.CUS_CMA_CRE}"  value="workChargeInput.jsp?action=add&page=#{B630Bean.pageRidiect}&fq100=#{B630Bean.fq100}&itemid=#{B630Bean.fk100}&height=340px&width=568px" styleClass="fancybox">
                                        <img src="../images/add_tab.png" alt="add" title="add" /><h:outputText value="#{locale.work_charge}"/> 
                                    </h:outputLink>

                                </div>
                                <div class="card_add"   style="display:<h:outputText value="#{B630Bean.displaycom}"/>">
                                    <h:outputLink  rendered="#{loginSession.right.COM_CMA_CRE}"   value="workChargeInputC.jsp?page=#{B630Bean.pageRidiect}&itemid=#{B630Bean.fk100}&height=340px&width=568px" styleClass="fancybox">
                                        <img src="../images/add_tab.png" alt="add" title="add" /><h:outputText value="#{locale.work_charge}"/> 
                                    </h:outputLink>

                                </div>
                                <div class="item_work_content">

                                    <div class="content_table ">
                                        <div class="rich_table viewData" id="tableData">
                                            <table>
                                                <tr class="table_thead" id="table_header">
                                                    <td class="table_subheadercell " style="width: 90px">
                                                        <h:outputText value="Action" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 35px">
                                                        <h:outputText value="Hoàn<br/> thành" escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 200px">
                                                        <h:outputText value="#{locale.title}" />
                                                    </td>                                               
                                                    <td class="table_subheadercell " style="width: 200px">
                                                        <h:outputText value="Hạn mục" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 170px">
                                                        <h:outputText value="Họ tên" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 80px">
                                                        <h:outputText value="Số điện thoại" escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 200px">
                                                        <h:outputText value="Email"  escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 250px">
                                                        <h:outputText value="Công ty" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 60px">
                                                        <h:outputText value="Trạng thái" escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 60px">
                                                        <h:outputText value="Bắt đầu" escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 60px">
                                                        <h:outputText value="Kết thúc" escape="false"/>
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 250px">
                                                        <h:outputText value="Ghi chú" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 250px">
                                                        <h:outputText value="Người chịu TN" />
                                                    </td>
                                                    <td class="table_subheadercell " style="width: 250px">
                                                        <h:outputText value="Người cập nhật" />
                                                    </td>                                                
                                                </tr>
                                            </table>

                                            <div style="div_content">                                     
                                                <table>
                                                    <a4j:repeat value="#{B630Bean.listAllN630itemCN}" var="item" rowKeyVar="index">
                                                        <tr class=" noteRow" lang="<h:outputText value="#{item.bv631} - #{item.hoten}"/>" >
                                                            <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/> " style="width:90px" >

                                                                <h:outputLink  rendered="#{loginSession.right.CMA_LST_MOD}"  value="workChargeInput.jsp?action=edit&page=workChargeCM.jsp&pb630=#{item.pb630}&fq100=#{B630Bean.fq100}&height=300px&width=500px" styleClass="fancybox">
                                                                    <img src="../images/edit.png" alt="edit" title="edit"/>
                                                                </h:outputLink>
                                                                <h:outputLink  rendered="#{loginSession.right.CMA_LST_DEL}"  value="deleteB630.jsp?action=delete&page=#{B630Bean.pageRidiect}&fq100=#{item.fq100}&itemid=#{item.fk100}&fb670=#{item.fb670}&pb630=#{item.pb630}&height=150px&width=300px" styleClass="fancybox">
                                                                    <img src="../images/delete_1.png" alt="delete"  title="delete" />
                                                                </h:outputLink>
                                                                <h:outputLink rendered="#{loginSession.right.CMA_LST_DES}" value="noteWorkChargeInput.jsp?action=addNote&page=workChargeCM.jsp&pb630=#{item.pb630}&title=#{item.bv631} - #{item.hoten}&height=300px&width=500px" styleClass="fancybox" style="margin-left:3px;">
                                                                    <img  alt="Thêm ghi chú" src="../images/qb_email_add.png" width="15px" height="15px">
                                                                </h:outputLink>

                                                                <h:graphicImage rendered="#{loginSession.right.CMA_LST_VDE}" value="../images/history.png" height="15px" width="15px" alt="Ghi chú" title="Ghi chú" styleClass="showNote" lang="#{item.pb630}">                                                            
                                                                </h:graphicImage>



                                                            </td> 
                                                            <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/> " style="width: 35px">
                                                                <h:panelGroup rendered="#{loginSession.right.CMA_LST_CHE}">
                                                                    <h:selectBooleanCheckbox rendered="#{item.bv638=='A'}" value="#{B630Bean.checkComplete}" lang="#{item.pb630}" styleClass="checkComplete" style="float:left;margin-left:10px"/>
                                                                </h:panelGroup>
                                                            </td>
                                                            <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 200px">
                                                                <h:outputLink value="workChargeCM.jsp?page=customer.jsp">
                                                                    <h:outputText value="#{item.bv631}"  escape="false"/>
                                                                </h:outputLink>

                                                            </td>
                                                            <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 200px"> 
                                                                <h:outputText value="#{item.bv671}"  escape="false"/>
                                                            </td>
                                                            <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 170px;">
                                                                <a href='customer.jsp?pnPN100=<h:outputText value="#{item.fq100}"/>&type=<h:outputText value="#{item.nn104}"/>'>  <h:outputText value="#{item.hoten}"></h:outputText></a>


                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 80px"> 

                                                                <a href="sendSMS.jsp?action=sendSMS&hoten=<h:outputText value="#{item.hoten}" />&pn100=<h:outputText value="#{item.fq100}" />&phone=<h:outputText value="#{item.nv108}" />" class="fancybox actionsendsms"> <h:outputText value="#{item.nv108}" styleClass="phone" lang="#{item.nv108}"/> </h2> <h:outputText rendered="#{item.nv108=='' ||  item.nv108== null}" value="<br/>" escape="false"/></a></h2>
                                                            </td>
                                                            <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 200px"> 

                                                                <h:outputLink value="popupSendMailPerson.jsp?page=workChargeCM&idx=#{item.fq100}&mailx=#{item.nv105}&typex=workChargeCM&KeepThis=true&amp;TB_iframe=true&amp;height=653&amp;width=741&amp;modal=true" styleClass="thickbox add_new" id="thickbox3"  ><h:outputText value="#{item.nv105}" /></h:outputLink>
                                                                </td>
                                                                <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 250px"> 
                                                                <h:outputText value="#{item.kv103}"></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 60px"> 
                                                                <h:outputText rendered="#{item.bv638 == 'T'}" value="Hoàn thành"></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 60px"> 
                                                                <h:outputText value="#{item.bd632}"><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 60px"> 
                                                                <h:outputText value="#{item.bd633}"><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssLeft <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 250px"> 
                                                                <h:outputText value="#{item.bv635}"></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 250px"> 
                                                                <h:outputText value="#{item.nv106}"></h:outputText>
                                                                </td>
                                                                <td class="table_cell cssHeight cssCenter <h:outputText rendered="#{index%2 !=0}"  value="odd"/>" style="width: 250px"> 
                                                                <h:outputText value="#{item.bl648} "><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText><h:outputText value="<br/>(#{item.bl649})" escape="false"></h:outputText>
                                                                </td>                                                    
                                                            </tr>
                                                            <tr>
                                                                <td colspan="14">
                                                                <h:panelGroup rendered="#{index%2 !=0}" id="his_detail1" styleClass="noteContent odd"  >
                                                                </h:panelGroup>
                                                                <h:panelGroup rendered="#{index%2 ==0}" styleClass="noteContent" >
                                                                </h:panelGroup>
                                                            </td>
                                                        </tr>

                                                    </a4j:repeat>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </a4j:form>
        </f:view>
    </body>
</html>